package com.ls.config;

import com.ls.interceptor.LoginCheckInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author atom.hu
 * @version V1.0
 * @Package com.ls.config
 * @date 2021/10/13 16:39
 */
@Configuration
public class LoginCheckInterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginCheckInterceptor()).addPathPatterns("/**")
                .excludePathPatterns("/employee/login","/employee/logout","/backend/**"
                        ,"/front/**","/common/**","/user/login","/user/sendMsg");
        //思考，为什么这里排除一个拦截路径就会添加失败,"/user/login","/user/sendMsg"
        //,/user/login","/user/sendMsg","/dish/status/0"
        //                        ,"/common/download","/error
    }
}
